package com.neutech.controller;

import com.neutech.mapper.MenuMapper;
import com.neutech.service.DisposalService;
import com.neutech.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;

import com.neutech.vo.*;
@CrossOrigin
@RestController
public class DisposalController {
    @Autowired
    private DisposalService disposalService;


    @RequestMapping("/disposal")
    public List<Map<String,Object>> getDisposal(){
        return disposalService.queryDisposal();
    }

    @RequestMapping("/insertDisposal")
    public void insDisposal(@RequestParam Map  map){
        disposalService.insertDisposal(map);
        System.out.println(map.get("disid"));
    }
    @RequestMapping("/deleteDisposal")
    public void delDisposal(@RequestParam Map  map){
        disposalService.deleteDisposal(map);
        System.out.println(map.get("disid"));
    }
    @RequestMapping("/updataDisposal")
    public void updDisposal(@RequestParam Map  map){
          System.out.println("看这里");
//        System.out.println(map);
//        System.out.println("看这里");
    Map<String,Object> map2 = new HashMap<>();
        map2.put("disid",map.get("disid"));
        map2.put("name",map.get("name"));
        map2.put("sort",map.get("sort"));
        map2.put("item",map.get("item"));
        map2.put("dep",map.get("dep"));
        map2.put("whe",map.get("whe"));
        map2.put("price",map.get("price"));

        disposalService.updataDisposal(map2);
}
}
